my_list = [7, 1, 8, 23, 67, 100]


def poplist(my_list, reverse=False):
    length = len(my_list)
    for j in range(length - 1):
        for i in range(length - 1 - j):  # 因为每轮比较后，最大或者最小值已经排到最后了，所以最后就不用再进行对比了，故减掉j
            if reverse:
                if my_list[i] > my_list[i + 1]:
                    pass
                else:
                    my_list[i], my_list[i + 1] = my_list[i + 1], my_list[i]
            else:
                if my_list[i] < my_list[i + 1]:
                    pass
                else:
                    my_list[i], my_list[i + 1] = my_list[i + 1], my_list[i]
    print(my_list)


poplist(my_list=my_list)
# poplist(my_list=my_list, reverse=True)


print(sorted(my_list, reverse=True))
list1 = [20, 15, 88, 97, 76, 13, 27, 49]


def quict_sort(list1):
    if list1 == []:
        return []
    else:
        first = list1[0]
        less = quict_sort([l for l in list1[1:] if l < first])
        morr = quict_sort([m for m in list1[1:] if m >= first])
    return less + [first] + morr


aaa = quict_sort(list1)
print(aaa)
